package com.sunday.boot3.user.center.pojo.dto.permissions;

import com.sunday.common.core.gson.GsonUtils;
import com.sunday.common.core.remoting.base.auth.BaseDTO;
import com.sunday.redisson.annotation.OpenDistributedLock;
import jakarta.validation.constraints.*;
import lombok.Data;


/**
 * @Description: 权限表 请求 DTO
 * @author: zsy
 * @Create: 2024/09/20 15:13:06
 */
@Data
public class UpdatePermissionsReqDTO extends BaseDTO {

    /**
     * 主键
     */
    @NotNull
    @Positive
    @OpenDistributedLock(PermissionsConstants.TABLE_NAME)
    private Long id;

    /**
     * 名称
     */
    @NotBlank
    @Size(min = 1, max = 50)
    private String name;

    /**
     * 类别: 10. 后台权限(web 访问数据) 20. 路由权限(route permissions) 21. 页面权限(fine grit permissions) 30. 接口权限(api 能力权限)
     */
    @NotNull
    @Positive
    private Integer category;

    /**
     * 路径
     */
    @NotBlank
    @Size(min = 1, max = 200)
    private String url;

    /**
     * 权限位
     */
    @NotNull
    @Positive
    private Integer position;

    /**
     * 权限码
     */
    @NotNull
    @Positive
    private Long code;

    /**
     * 父级ID
     */
    @NotNull
    @PositiveOrZero
    private Long parentId;


    @Override
    public String toString() {
        return GsonUtils.DEFAULT.toJson(this);
    }

}
